import { Input, Button } from "antd";
import * as React from "react";
import classNames from 'classnames';
import style from "src/tool/component/shared/TableOperator/style.module.less";
class TableOperator extends React.Component<any, any> {
  public constructor(props) {
    super(props);
  }

  public render() {
    const wrapper = classNames('clearfix', style.wrapper)
    const parameters = this.props;
    return (
      <div className={wrapper}>
        <Button
          type="primary"
          onClick={parameters.onButtonClick}
          style={{ float: "right" }}
        >
          {parameters.buttonName}
        </Button>
        {/* TODO 点击按钮不触发数据库变动，只是前端数据变化，可回朔，所以暂时用不到确认框
            <Modal
            title={parameters.modalContent.title}
            visible={parameters.modalContent.visible}
            onOk={parameters.handleOk}
            confirmLoading={parameters.modalContent.confirmLoading}
            onCancel={parameters.handleCancel}
          >
            <p>{parameters.modalContent.ModalText}</p>
          </Modal>*/}
        {parameters.hasSearchBox ? (
          <div className={style["search-box"]}>
            <label className={style["search-label"]}>
              {parameters.labelText}:
            </label>
            <Input.Search
              className={style["search-input"]}
              placeholder={parameters.placeholderContent}
              onSearch={parameters.handlerSearch}
            />
          </div>
        ) : null}
      </div>
    );
  }
}

export default TableOperator;
